package com.trg.flex.remote
{
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	public class ReconnectStrategy
	{
		public var manager:RemoteCallManager;
		private var timer:Timer = new Timer(0, 1);
		
		public function ReconnectStrategy(manager:RemoteCallManager = null) {
			timer.addEventListener(TimerEvent.TIMER, test);
			this.manager = manager;
		}
		
		public function start():void {
			timer.delay = 6000;
			timer.start();
		}
		
		public function next():void {
			timer.delay = 6000;
			timer.start();
		}
		
		public function stop():void {
			timer.stop();			
		}
		
		private function test(event:TimerEvent):void {
			manager.testConnection();
		}
	}
}